<template>
  <view class="settle-container">
    <!-- 全选按钮 -->
    <label class="radio">
      <radio :checked="isFullChecked" color="#0055ff" @click="isAllChecked" /><text>全选</text>
    </label>
    <!-- 合计 -->
    <view class="amount-box">
      合计:<text class="checked-amount">￥{{checkedGoodsTotalPrice}}</text>
    </view>
    <!-- 结算 -->
    <view class="btn-settle">结算({{checkedGoodsCount}})</view>
  </view>
</template>

<script>
  import {
    mapGetters,
    mapMutations
  } from 'vuex'
  export default {
    name: "my-settle",
    data() {
      return {

      };
    },
    computed: {
      ...mapGetters('m_cart', ['total', 'checkedGoodsCount', 'checkedGoodsTotalPrice']),
      isFullChecked() {
        return this.total === this.checkedGoodsCount
      }
    },
    methods: {
      ...mapMutations('m_cart', ['updateAllGoodsState']),
      isAllChecked() {
        this.updateAllGoodsState(!this.isFullChecked)
      }
    }
  }
</script>

<style lang="scss">
  .settle-container {
    position: fixed;
    bottom: 0;
    height: 50px;
    width: 100%;
    border-top: 1px solid #efefef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 5px;
    background-color: #fff;

    .radio {
      display: flex;
      align-items: center;
    }

    .amount-box {
      .checked-amount {
        color: #c00000;
      }
    }

    .btn-settle {
      height: 50px;
      width: 100px;
      background-color: #c00000;
      color: #fff;
      text-align: center;
      line-height: 50px;
    }
  }
</style>